home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93a.txt / 000110_icon-group-sender _Fri Apr 2 10:02:24 1993.msg < prev    next >
Internet Message Format  |  1993-04-21  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Sat, 10 Apr 1993 05:36:01 MST
  2. Date: 2 Apr 93 10:02:24 GMT
  3. From: mcsun!news.funet.fi!uta!jere@uunet.uu.net  (Jere K{pyaho)
  4. Organization: University of Tampere, Finland
  5. Subject: Icon rookie problems solved
  6. Message-Id: <9364@kielo.uta.fi>
  7. Sender: icon-group-request@cs.arizona.edu
  8. To: icon-group@cs.arizona.edu
  9. Status: R
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11.  
  12. Thanks to those people who took the time to help me with my
  13. (admittedly trivial) problem concerning Exercise 3.1 of
  14. "The Icon Programming Language" (2nd Ed.). I am just learning
  15. Icon, and I was very happy to get prompt and friendly
  16. answers. 
  17.  
  18. The problem was to write a procedure which generates all
  19. the characters of a string that are found in a given cset,
  20. from left to right. That is, given the string "input and
  21. output" and the cset 'ut', the procedure should generate
  22. "u", "t", "u", "t", "u", and "t".
  23.  
  24. For the record, here is my solution:
  25.  
  26. #-------cut here------------------
  27.  
  28. procedure main( L )
  29.   genchar( L[1], L[2] )  # don't know how to validate these yet :-)
  30. end
  31.  
  32. procedure genchar( s, c )
  33.   s ? {
  34.     every i := upto( c ) do {
  35.       tab( i )
  36.       write( move( i ) )
  37.     }
  38.   }
  39. end
  40.  
  41. #--------cut here-----------------
  42.  
  43. Although I'm fascinated by Icon, I don't find this example
  44. too intuitive. Maybe it could be further reduced?
  45.  
  46. As to my second problem, it turned out to be an RTFM error.
  47. The document IPD205.DOC clearly states that you can't build
  48. the Icon version 8.8 compiler under MS-DOS without a 32-bit
  49. compiler and a DOS extender, neither of which I own. Oh well.
  50. -- 
  51. // Jere K{pyaho (jere@kielo.uta.fi)   |   Work is the curse of the
  52. // University of Tampere, Finland     |   drinking classes. -Oscar Wilde
  53.